/**
 * This file is part of Idegen, the application to create IDE project files.
 *
 * @copyright Copyright (c) 2011-2012, Walter Tamboer http://waltertamboer.nl
 * @file Idegen/Idegen/IdegenProjectConfig.hpp
 */

#ifndef IDEGEN_IDEGEN_IDEGENPROJECTCONFIG_HPP
#define IDEGEN_IDEGEN_IDEGENPROJECTCONFIG_HPP

namespace Idegen
{
	class Settings;

	enum Charset;

	struct IdegenPrecompiledHeader;
	
	typedef std::vector< std::string > DefinitionList;
	typedef std::vector< std::string > IncludePathList;
	typedef std::vector< std::string > LibraryPathList;

	class IdegenProjectConfig
	{
	public:
		/** Initializes a new instance of this class. */
		IdegenProjectConfig();

		/** Cleans up all the resources used by this class. */
		virtual ~IdegenProjectConfig();

		/**
		 * Gets the charset.
		 *
		 * @return Returns a string.
		 */
		Charset GetCharset() const;

		/**
		 * Gets the definitions for the preprocessor.
		 *
		 * @return Returns a list with definitions.
		 */
		DefinitionList GetDefinitions() const;

		/**
		 * Gets the include directories that this configuration has.
		 *
		 * @return Returns a list with all include paths.
		 */
		IncludePathList GetIncludeDirectories() const;

		/**
		 * Gets the library directories that this configuration has.
		 *
		 * @return Returns a list with all library paths.
		 */
		LibraryPathList GetLibraryDirectories() const;

		/**
		 * Gets the name of the configuration.
		 *
		 * @return Returns a string.
		 */
		std::string GetName() const;

		/**
		 * Gets the output path.
		 *
		 * @return Returns a string.
		 */
		std::string GetOutputPath() const;

		/**
		 * Gets the platform of the configuration.
		 *
		 * @return Returns a string.
		 */
		std::string GetPlatform() const;

		/**
		 * Gets the temporary path to store build files.
		 *
		 * @return Returns a string.
		 */
		std::string GetTempPath() const;
		
		/**
		 * Gets the precompiled header of this project.
		 *
		 * @return Returns the precompiled header.
		 */
		IdegenPrecompiledHeader* GetPrecompiledHeader() const;

		/**
		 * Gets the warning level of the compiler.
		 *
		 * @return Returns the warning level.
		 */
		int GetWarningLevel() const;

		/**
		 * Unserializes a project configuration.
		 *
		 * @param[in] settings The settings used to parse.
		 * @param[in] parent The parent element.
		 */
		void Unserialize( Settings* settings, TiXmlElement* parent );

		/**
		 * Whether or not to use debug libraries
		 *
		 * @return Returns true when to use debug libraries; false otherwise.
		 */
		bool UseDebugLibraries() const;

		/**
		 * Whether or not to use warnings as errors.
		 *
		 * @return Returns true when warnings should be used as errors; false otherwise.
		 */
		bool UseWarningsAsErrors() const;

	private:
		/**
		 * Parses the attributes.
		 *
		 * @param[in] settings The settings used to parse.
		 * @param[in] parent The element to parse.
		 */
		void ParseAttributes( Settings* settings, TiXmlElement* parent );

		/**
		 * Parses a precompiled header setting.
		 *
		 * @param[in] settings The settings used to parse.
		 * @param[in] parent The element to parse.
		 */
		void ParsePrecompiledHeader( Settings* settings, TiXmlElement* parent );

		/** The charset of the platform. */
		Charset m_Charset;

		/** A list with all preprocessor definitions. */
		DefinitionList m_Definitions;

		/** A list with all include directories. */
		IncludePathList m_IncludeDirectories;
		
		/** A list with all library directories. */
		LibraryPathList m_LibraryDirectories;

		/** The name of the configuration. */
		std::string m_Name;

		/** The path to save the project output. */
		std::string m_OutputPath;

		/** The platform that is being build for. */
		std::string m_Platform;

		/** The precompiled header used for this project. */
		IdegenPrecompiledHeader* m_PrecompiledHeader;

		/** The temp path. */
		std::string m_TempPath;

		/** Whether or not the use debug libraries. */
		bool m_UseDebugLibraries;

		/** The warning level of the compiler. */
		int m_WarningLevel;

		/** Whether or not warnings should be handled as errors. */
		bool m_WarningsAsErrors;
	};
}

#endif
